package test;

import java.util.Arrays;

public class exercise_4 {

	public static void main(String[] args) {
		int[] oldArr = { 1, 3, 4, 5, 0, 0, 6, 5, 4, 6, 7 };
		int count = 0;
		for(int i:oldArr) {
			if(i!=0) {
				count++;
			}
		}
		int[] newArr = new int[count];
		int j = 0;
		for (int i = 0; i < oldArr.length; i++) {

			if (oldArr[i] != 0) {
				newArr[j++] = oldArr[i];
			}
			
		}
		System.out.println(Arrays.toString(newArr));
	}

}
